import React, {Component} from 'react';

class Dianzan extends Component {
    constructor(){
        super();
        this.state = {
            isLike: false
        }
    }

    updateState(){
        this.setState({
            isLike: !this.state.isLike
        })
    }

    render(){
        const curState = this.props.curState || {
            agree: "同意",
            disAgree: "不同意"
        }
        return (
            <button onClick={this.updateState.bind(this)}>
                {this.state.isLike ? curState.agree : curState.disAgree}
            </button>
        )
    }
}

export default Dianzan